#ifndef __ORIGINATOR_H__
#define __ORIGINATOR_H__

#include <memory>
#include <iostream>
class Memento;
class Originator
{
public:
    using ptr=std::shared_ptr<Originator>;
    enum State {
        StateOne=1,
        StateTwo=2,
        StateThree=3,
        StateFour=4,
        StateFive=5
    };
    Originator(State state, int lifeValue, int attackValue, int defenceValue);
    //保存当前状态
    std::shared_ptr<Memento> saveState();
    //设置当前对象的备忘录状态
    void setAll(State state,int lifeValue, int attackValue, int defenceValue);
    void setMemento(std::shared_ptr<Memento> memento);
    Originator::State getState(){return m_state;}
    void setState(State state){m_state=state;}
    int getLifeValue(){return m_lifeValue;}
    void setLifeValue(int lifeValue){m_lifeValue=lifeValue;}
    int getAttackValue(){return m_attackValue;}
    void setAttackValue(int attackValue){m_attackValue=attackValue;}
    void setDefenceValue(int defenceValue){m_defenceValue=defenceValue;}
    int getDefenceValue(){return m_defenceValue;}
    void displayState();
private:
    State m_state;
    int m_lifeValue=100;
    int m_attackValue=100;
    int m_defenceValue=100;
};
#endif